%% $Id: xyps.doc,v 2.12 1994/10/25 03:01:14 ross Exp $ %% XY-pic ``PostScript backend''. %% Copyright (c) 1993-1994 Ross Moore %% This file is part of the XY-pic package for graphs and diagrams in TeX. %% See the companion README and INSTALL files for further information. %% Copyright (c) 1991-1994 Kristoffer H. Rose %% The XY-pic package is free software; you can redistribute it and/or modify %% it under the terms of the GNU General Public License as published by the %% Free Software Foundation; either version 2 of the License, or (at your %% option) any later version. %% The XY-pic package is distributed in the hope that it will be useful, but %% WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY %% or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License %% for more details. %% You should have received a copy of the GNU General Public License along %% with this package; if not, write to the Free Software Foundation, Inc., %% 675 Mass Ave, Cambridge, MA 02139, USA. \ifx\xyloaded\undefined \input xy \fi \xyprovide{ps}{PostScript backend}{\stripRCS$Revision: 2.12 $}% {Ross Moore}{ross@mpce.mq.edu.au}% {Mathematics Department, Macquarie University, NSW~2109, Australia} \DOCMODE3%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \XY-ps is a `back-end' which provides \XY-pic with the ability to produce DVI files that use \PS\footnote{\PS\ is a registered Trademark of Adobe Systems, Inc.} |\specials| for drawing rather than the \XY-pic fonts. In particular this makes it possible to print \XY-pic DVI files on systems which do not have the ability to load the special fonts. The penalty is that the generated DVI files will only function with one particular DVI driver program. Hence whenever \XY-ps is activated it will warn the user: *+\txt<.8\hsize>{\XY-pic Warning: The produced DVI file is "not portable": It contains \PS\ {\tt\string\special}s for driver} *\frm{-} \endxy A more complete discussion of the pros and cons of using this backend is included below. \DOCMODE2%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \paragraph*{Header:}\leavevmode \DOCHEADER \DOCMODE3%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \subsection{Choosing the DVI-driver} ??=[choosing DVI-driver] To activate the use of \PS\ the user must specify one of the following command that selects the format of the |\special|s to be used: \begin{defs} ??c![\UsePSspecials] |{||}| & \cr \noalign{\smallskip} ??c![\NoPSspecials] & cancels \PS \cr ??c![\UsePSspecials] & restores \PS \end{defs} \noindent\unskip The |\UsePSspecials| initially causes a special driver file (see below) to be read. This file contains definitions which are specific to the particular . Note that some drivers may not be able to support all of the \PS\ effects that can be requested from within \XY-pic. When an unsupported effect is encountered, it is simply ignored. A message warning that the requested effect is unavailable will be produced unless too many such messages have already been issued. Use of fonts is restored at any point by calling |\NoPSspecials|, after which use of \PS\ is restored by using |\UsePSspecials|, without need of an argument. This allows \PS\ to be turned on and off for individual diagrams, or for portions of a single diagram. Use of these commands obeys normal \TeX\ scoping rules, so if |\NoPSspecials| or |\UsePSspecials| is specified within an environment, the previous setting will be restored upon leaving that environment. For users of \LaTeXe, and presumably \LaTeX3 (when it becomes available), the driver type will be inherited from any corresponding \PS\ option specified with the |\documentclass| command, see~\cite[page~317]{GMS94:LaTeXC}. The implicit |\UsePSspecials| will be executed at the |\begin{document}| line; hence any |\NoPSspecials| must occur after this to be effective. The following table, which mimics the one in the stated \LaTeXe\ reference, describes current support for \PS\ drivers: $*$ denotes full support, for all the features the driver can handle; $?$ denotes that some features have not been tested, but may still work; $-$ denotes no support as yet. Please note the spelling, which corresponds to the way the respective writers refer to their own products within their own documentation. Alternative combinations of upper- and lowercase letters are not guaranteed to work correctly. \vspace{.5pc}\noindent \begin{tabular}{@{\hspace{1pt}}llc@{\hspace{0pt}}} \hline & \hfil Description\hfil & \XY-ps \\ \hline \tt dvips & Tomas Rokicki's dvips & $*$ \\ \tt Textures & Blue Sky Research's \Textures & $*$ \\ \tt OzTeX & Andrew Trevorrow's \OzTeX & $*$ \\ \tt ln & Digital Corp. printers & $-$ \\ \tt dvitops &James Clark's dvitops & $?$ \\ \tt emtex & Eberhard Matte's em-\TeX & $-$ \\ \hline \end{tabular} \vspace{.5pc} Other DVI-drivers may already work if they use conventions similar to |dvips|, \OzTeX\ or \Textures. The \TeX\-nical documentation~\cite{R94:XY-picCSTC} in the file |xyps.doc| contains instructions concerning how to make \XY-ps work with other drivers. To have another driver specifically supported it is only necessary to inform the author of its existence, how it handles |\specials|, and negotiate with him a means for testing/verifying the implementation. It should be possible to change up until such time as a |\special| is actually used. This is to allow users to switch from a system default. This ability is new with version 2.9; any difficulties with this feature should be reported to the author The following lists the s available, including some experimental ones not mentioned above. The associated driver file is given in parentheses, along with any special considerations needed when using them. \DOCMODE1%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{description} \def\DRIVER#1#2#3{\item[{\tt#1} for {#2} (xyps-#3.tex):] \inputdoc1{xyps-#3.doc}\unskip} \DOCMODE2%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \def\DRIVER#1#2#3{\subsubsection{{\tt#1} for {#2} (xyps-#3.doc):}% \inputdoc2{xyps-#3.doc}} \DOCMODE3%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \DRIVER{dvips}{dvips}{dvi} \DRIVER{Textures}{\Textures}{txt} \DRIVER{OzTeX}{\OzTeX}{oz} \DRIVER{dvitops}{\tt dvitops}{dto} \DRIVER{dviwindo}{\tt dviwindo}{wdo} \DRIVER{dvipub}{\tt dvipub}{pub} \noindent Information to improve the abilities of these drivers should be conveyed to the author. Printed technical documentation or software would be the most useful form, though e-mail concerning good experiences would also be helpful. \smiley \DOCMODE1%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \end{description} \DOCMODE2%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% The default level of \PS\ is [4], see below. \DOCMODE( \xydef@\UsePSspecials{\DNii@{{[4]}}\xyFN@\UsePSspecials@i} \xydef@\UsePSspecials@i{% \ifx \space@\next \expandafter\DN@\space{\xyFN@\UsePSspecials@i}%gobble spaces \else\ifx [\next \DN@[##1]{\DNii@{{[##1]}}\xyFN@\UsePSspecials@i}% \else\ifcat 5\next \DN@##1{\DNii@{{[##1]}}\xyFN@\UsePSspecials@i}% \else\ifx\bgroup\next \DN@{\expandafter\UsePS@specials\nextii@}% \else \DN@{\expandafter\UsePS@specials\nextii@{[4]}}% \fi\fi\fi\fi \next@ } \DOCMODE) \TODO: There is redundancy between here and |\UsePSspecials@|. The value of |\setupxyPS@| \PS\ level could be set here rather than later in |\PSspecials@|. \DOCMODE( \xydef@\UsePS@specials#1#2{% \ifx\empty\whichPSspecials@ \DN@{#2}\ifx\next@\empty \else \expandafter\let\expandafter\next\csname#2@\endcsname \ifx\next\relax \DN@{\xyerror@{PostScript specials for `#2' not supported}{}}% \else \DN@{\expandafter\UsePSspecials@\csname#2@\endcsname#1}\fi \fi \else \DN@{#2}\ifx\next@\empty \DN@{\PSspecials@true}% \else \edef\next@{\expandafter\string\csname#2@\endcsname}% \edef\nextii@{\expandafter\string\whichPSspecials@}% \ifx\next@\nextii@\DN@{\PSspecials@true}% \else \ifx\firstPS@@\relax \DN@{\xyerror@{Only one PS allowed: \dvitype@ already loaded}{}}% \else \expandafter\let\expandafter\next\csname#2@\endcsname \ifx\next\relax \DN@{\xyerror@{PostScript specials for `#2' not supported}{}}% \else \xywarning@{Changing PS to #2 }% \DN@{\expandafter\UsePSspecials@\csname#2@\endcsname#1}% \fi \fi \fi \fi \fi \next@} \DOCMODE) \DOCMODE2%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% The following control sequences will also load the corresponding driver. They are retained for backwards compatibility only; they may be phased out of future releases: \begin{defs} |\UseDVIPSspecials| & |dvips| \cr |\UsePostScriptSpecials| & |dvips|\cr |\UseTexturesPSspecials| & |Textures| \cr |\UseTexturesSpecials| & |Textures| \end{defs} \DOCMODE( \xydef@\UseDVIPSspecials{\UsePSspecials@\dvips@} \xydef@\UseTexturesPSspecials{\UsePSspecials@\Textures@} \xydef@\UseTexturesSpecials{\UsePSspecials@\Textures@} \xydef@\UsePostScriptSpecials{\UsePSspecials@\dvips@} \xydef@\UseOzTeXspecials{\UsePSspecials@\OzTeX@} \xydef@\UseDVITOPSspecials{\UsePSspecials@\dvitops@} %\xylet@\UseDVIPSSpecials=\UseDVIPSspecials %\xylet@\UsePSspecials=\UsePostScriptSpecials %\xylet@\UseTeXturesPSspecials=\UseTexturesPSspecials %\xylet@\UseTexturesSpecials=\UseTexturesPSspecials %\xylet@\UseTeXturesSpecials=\UseTexturesSpecials \DOCMODE) \DOCMODE2%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \DOCMODE( \message{drivers,} \DOCMODE) First the driver is specified by |\UsePSspecials{||}|. This causes a special driver file to be read. Use of fonts is restored at any point by calling |\NoPSspecials|, after which use of \PS\ is re-instated by simply |\UsePSspecials|, without need of an argument. The commands described above for specific drivers are simply aliases for |\UsePSspecials@{||}|. Once the new bindings have been setup, then the use of |\special|s is governed by the value of the conditional |\ifPSspecials@|. \DOCMODE( \xydef@\loadPSdriver@#1#2{\xyinputorelse@{xy#1.tex}% {\xyerror@{Unable to load xy#1.tex for #2 driver}{}}} \xydef@\dvips@{\loadPSdriver@{ps-dvi}{dvips}} \xydef@\Textures@{\loadPSdriver@{ps-txt}{Textures}} \xydef@\OzTeX@{\loadPSdriver@{ps-oz}{OzTeX}} \xydef@\dvitops@{\loadPSdriver@{ps-dto}{dvitops}} \xydef@\dvipsone@{\loadPSdriver@{ps-one}{dvipsone}} \xydef@\dviwindo@{\loadPSdriver@{ps-wdo}{dviwindo}} %\xydef@\dviwin@{\loadPSdriver@{ps-win}{dviwin}} \xydef@\pubps@{\loadPSdriver@{ps-pub}{pubps}} \DOCMODE) The driver file contains definitions which are specific to the particular driver. Note that some drivers may not be able to support all of the \PS\ effects that can be requested from within \XY-pic. When an unsupported effect is encountered, it is simply ignored; a warning message will be produced unless too many such messages have already been issued. \DOCMODE( \global\newif\ifPSspecials@ \xydef@\UsePSspecials@#1{\gdef\whichPSspecials@{#1}\xyFN@\PSspecials@} \xydef@\whichPSspecials@{} \xydef@\NoPSspecials{\xywarning@{PostScript switched off.}% \PSspecials@false\aftergroup\resetPS@} \xydef@\resetPS@{\ifPSspecials@\xywarning@{PostScript switched back on.}\fi} \xydef@\xyPSraw@{% \ifPSspecials@\expandafter\PSraw@\else\expandafter\eat@\fi } \DOCMODE) \DOCMODE2%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \paragraph*{adding new drivers} ??=[new drivers] Other drivers can be added by including an appropriate control-sequence name for the driver at this point. The purpose of an expansion such as |\xydef@\OzTeX@{\noexpand\OzTeX@}| is so that this name always refers to a unique token. The macro |\PSspecials@@| defined below, detects this token and then calls up the appropriate macro to make the necessary bindings. Thus adding a new driver involves 5 steps: \begin{itemize} \item 1 Define a new control sequence, as just explained. \item 2 Define appropriately named macros to generate the desired |\special|s. (See the existing ones for examples of what is needed here.) \item 3 Define a macro that will perform the appropriate bindings of the different classes of |\special|. (See the existing ones for examples of what is needed here.) \item 4 Determine how frequently the \XY-ps dictionary must be included within the PostScript file. Once (at the beginning) is the ideal, however it may be necessary to include it with every page---this is the case with \Textures. Also if the dictionary can be loaded as a header or prolog, determine whether this can be done only once or must be for each page. Also check whether a specific name is required, as with \OzTeX. \item 5 Check to see whether the |\dumpPSdict| macro correctly write the dictionary to a file. The |\endlinechar| can be important here. \end{itemize} If the user requests a driver which is not currently supported then an error message will be produced. \DOCMODE( \xydef@\dvimessage@{% \xywarning@{The produced DVI file is NOT PORTABLE:^^J It contains PostScript \string\special s for the \dvitype@ driver% \PSheadermessage@}} \xywarnifdefined\dvitype@ \xydef@\PSheadermessage@{} \DOCMODE) \XY-ps works by rebinding existing control sequence names, in the \XY-pic kernel and extensions, to have new expansions. These new expansions may eventually typeset nothing, or at most an empty box; instead they use a |\special| command to place \PS\ code directly into the |.dvi| file (or |DVI2| resources in the case of \Textures on the Macintosh). The new expansions alter the \TeX\ processing often simplifying it considerably, thus leading to savings in both time and memory. It should not be possible to mix |\specials| intended for different drivers. Thus the first use of |\PSspecials@| will establish which driver is required then rebinds |\UsePSspecials@| so that no other driver can be used; subsequent attempts to use |\UsePSspecials@| simply result in the same driver being reinstated. \DOCMODE( \xydef@\PSspecials@{% \ifx\next[\DN@[##1]{\setxyPSlevel@{##1}\xyFN@\PSspecials@}% \else\DN@{\whichPSspecials@\PSspecials@@}% \fi \next@ }% \xydef@\PSspecials@@{% \ifx\und@fined\PSmessage\hidePSmessages\fi \setupxyPS@} \DOCMODE) An optional argument to the |\UsePSspecials| command allows for some control over precisely when \PS\ |\specials| will be used. Similarly |\UseDVIPSspecials| and |\UseTexturesSpecials|, etc. can take an optional argument. For example, |\UsePSspecials[1]| replaces only font characters with a \PS\ drawing of the same character. Both the \PS\ and the bitmapped fonts should produce (virtually) identical printed images. This is primarily a test mode. |\UsePSspecials[2]| also only replaces font characters but such that the number of possible directions is 8192, so that arrowheads turns and hooks fit better. |\UsePSspecials[3]| draws straight and dotted lines from a single |\special| command, and similarly for circle segments. The printed output should be identical to that obtained with |\UsePostScriptSpecials[2]|, but the size of the |.ps| file should be smaller. |\UsePSspecials[4]| is the default level; all PostScript is turned on. Dotted curves use equally spaced dots, dashed curves have curved dashes; even dashed lines are better. |\UsePSspecials[0]| does no rebinding of fonts at all. It allows the special effects, such as rotation, scaling, colour, etc defined in extensions, to be implemented while using the XY-pic fonts. \DOCMODE( \xydef@\setupxyPSlevelO@{\relax} \xydef@\setxyPSlevel@#1{\ifcase#1% \gdef\setupxyPS@{\setupxyPSlevelO@}% \or\gdef\setupxyPS@{\setupxyPSlevelA@}% \or\gdef\setupxyPS@{\setupxyPSlevelB@}% \or\gdef\setupxyPS@{\setupxyPSlevelC@}% \or\gdef\setupxyPS@{\setupxyPSlevelD@}% \else\gdef\setupxyPS@{\setupxyPSlevelD@}\fi } \xywarnifdefined\setupxyPS@ \gdef\setupxyPS@{\setupxyPSlevelD@} \xydef@\PSincrease@#1{% \xywarning@{The PS level may only increase: #1 is already active}} \DOCMODE) \DOCMODE3%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \subsection{Why use \PS.} ??=[why PostScript] At some sites users have difficulty installing the extra fonts used by \XY-pic. The |.tfm| files can always be installed locally but it may be necessary for the |.pk| bitmap fonts (or the |.mf| \MF\ fonts) to be installed globally, by the system administrator, for printing to work correctly. If \PS\ is available then \XY-ps allows this latter step to be bypassed. \NOTE: with \XY-ps it is still necessary to have the |.tfm| font metric files correctly installed, as these contain information vital for correct typesetting. \medskip\noindent Other advantages obtained from using \XY-ps are the following: \begin{itemize} \item[$\bullet$] Circles and circle segments can be set for arbitrary radii. \DOCMODE2%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% No longer are we limited to just those sizes available in the |xycirc10| font. \DOCMODE3%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \item[$\bullet$] Straight lines are straighter and cleaner. \DOCMODE2%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% They are no longer typeset as a collection of fixed-sized segments (drawn from the |xydash10| font). Previously special placement algorithms were required, to construct lines of arbitrary length in up to 8192 distinct directions, from the 128 characters in the font. These algorithms are no longer required, giving improved \TeX\ processing, as well as having smooth lines of arbitrary length and direction limited only by the resolution of the \PS\ device. \DOCMODE3%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \item[$\bullet$] The range of possible angles of directionals is greatly increased. \DOCMODE2%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% For arrow tips, hooks, and turns, there are now 8192 possible orientations rather than just the 128 contained in the |xyatip10|, |xybtip10|, and |xybsql10| fonts. \DOCMODE3%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \item[$\bullet$] Spline curves are smoother. True dotted and dashed versions are now possible, using equally spaced segments which are themselves curved. %\item[$\bullet$] %The amount of information stored in the |.dvi| file is greatly reduced when %specifying a curve or a line of more than just a few segments. This is %accompanied by a reduction in memory requirements and processing time, thus %giving a notable saving in time and file size. \item[$\bullet$] The \PS\ file produced by a driver from an \XY-ps DVI file is in general significantly smaller than one produced by processing an `ordinary' DVI file using the same driver. One reason for this is that no font information for the \XY-pic fonts is required in the \PS\ file; this furthermore means that the use of \XY-pic does not in itself limit the \PS\ file to a particular resolution.\footnote{Most \TeX\ \PS\ drivers store the images of characters used in the text as bitmaps at a particular resolution. This means that the \PS\ file can only be printed without loss of quality (due to bitmap scaling) at exactly this resolution.} \item[$\bullet$] The latest version of \XY-pic now enables special effects such as variable line thickness, gray-level and colour. Also, rotation of text and (portions of) diagrams is now supported with some drivers. Similarly whole diagrams can be scaled up or down to fit a given area on the printed page. Future versions will allow the use of regions filled with colour and/or patterns, as well as other attractive effects. \end{itemize} Some of the above advantages are significant, but they come at a price. Known disadvantages of using \XY-ps include the following: \begin{itemize} \item[$\bullet$] A DVI file with specials for a particular \PS\ driver can only be previewed if a previewer is available that supports exactly the same |\special| format. A separate \PS\ previewer will usually be required. \item[$\bullet$] The DVI files created using \XY-ps lose their ``device-independence''. So please do not distribute DVI files with \PS\ specials---send either the \TeX\ source code, expecting the recipient to have \XY-pic~\smiley, or send a (compressed) \PS\ file. \end{itemize} \DOCMODE3%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \paragraph*{\PS\ header file} With some DVI-drivers it is more efficient to have the \PS\ commands that \XY-ps needs loaded initially from a separate ``header'' file. %|dvips| has the ability to do this, as does \Textures\ provided that it %is loaded on each page. %In the case of \OzTeX, %this is the only way that \XY-ps can be made to work at all. To use this facility the user has the following commands available\dots \begin{defs1} ??c![\UsePSheader{}] \cr ??c![\UsePSheader{}] \cr ??c![\dumpPSdict{}] \cr ??c![\xyPSdefaultdict] \end{defs1} \xyPSdefaultdict The |\UsePSheader| command must be specified before |\UsePSspecials{||}| is invoked. It allows the name of the dictionary file to be specified as the . Normally it is sufficient to invoke |\UsePSheader{}|, which will use the default dictionary name of {\tt\xyPSdictname}, referring to the current version of \XY-pic and \XY-ps. \DOCMODE( \xywarnifdefined\xyPSdictname \xydef@\xyPSdefaultdict{% \DN@##1.##2.##3@{\gdef\xyPSdictname{xy##1##2dict.ps}}% \expandafter\next@\xyversion.@} \xydef@\UsePSheader@#1{% \DN@{#1}\ifx\next@\empty \ifx\xyPSdictname\undefined\xyPSdefaultdict\fi \else \gdef\xyPSdictname{#1}\fi \gdef\PSheadermessage@{.^^J It includes a reference to the PostScript file \xyPSdictname}% \UsePSdict@@true } \xynew@{if}\ifUsePSdict@@ \xylet@\UsePSheader=\UsePSheader@ \DOCMODE) See the documentation for the specific driver to establish where the dictionary file should be located on any particular \TeX\ system. Usually it is sufficient to have a copy in the current working directory. Invoking the command |\dumpPSdict{}| will place a copy of the requisite file, having the default name, in the current directory. This file will be used as the dictionary for the current processing, provided it is on the correct directory path, so that the driver can locate it when needed. Consult your local system administrator if you experience difficulties. \DOCMODE( \xydef@\dumpPSdict#1{\DN@{#1}\ifx\next@\empty \ifx\undefined\xyPSdictname\xyPSdefaultdict\fi \else\gdef\xyPSdictname{#1}\fi \writePSdict@@ }% \DOCMODE) \DOCMODE2%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Multiple instances of |\UsePSheader| and |\dumpPSdict| are possible, only the last will determine which file is used for the current document. The command |\xyPSdefaultdict| reverts to the default name. \OzTeX\ is special in that the dictionary is always required, so |\UsePSheader| is invoked automatically by |\UsePSspecials{OzTeX}|. Furthermore, \OzTeX\ requires the filename to be |global.ps|. If a file of this name is not found then \XY-ps automatically dumps the dictionary into the current directory. \TODO: Optimize the \PS\ dictionary by using shorter names. This is to reduce the size of the |.ps| files generated using \XY-ps. \DOCMODE2%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% The feature of allowing an arbitrary with |\UsePSheader| is to allow flexibility with systems that may impose special requirements on the filenames of files to be used as \PS\ header files. \OzTeX\ is one such. It also caters for advanced users of \XY-pic who may wish to experiment with customising the \PS\ to obtain new effects. For example, colour can be introduced to various elements of \XY-pic diagrams; though this requires a colour \PS\ previewer or printer to observe the effect. Similarly the line thickness and the shape of arrowheads can be altered in this way. \DOCMODE2%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% The first two control sequences here are used in the DVI-driver files to control when the \PS\ can be altered. \DOCMODE( \xydef@\firstPS@{\ifx\firstPS@@\relax\else\global\let\firstPS@@=\relax\fi} \xylet@\firstPS@@=\firstPS@ \xydef@\includeXYPSdict@{% \expandafter\PSinclude@\expandafter{\xyPSdictname}} \xylet@\includeXYPSdict=\includeXYPSdict@ \xydef@\endXYdict@{} \xydef@\includePSmessage@{\message{=2 | \gdef\xyPS@@<%%>\gdef\xyPS@@@<%!>} \xywarnifdefined\writePSdict@@ {\catcode`|=14 \catcode`\%=12 \gdef\writePSdict@@{{| % \ifx\undefined\xyPSdictwrite@ \xynew@{write}\xyPSdictwrite@ \fi % \immediate\openout\xyPSdictwrite@=\xyPSdictname \relax \immediate\openout\xywrite@=\xyPSdictname \relax \message{}| \DOCMODE) Within the expansion of |\XYdict@| the end-of-line tokens are still active. The following expansion seems to work on all systems so far tested. \DOCMODE( \xywarnifdefined\obeyoutlines@ {\catcode`\^^M=\active \gdef\obeyoutlines@{\catcode`\^^M=\active \def^^M{^^J}% \newlinechar=`\^^J\obeyspaces}} \DOCMODE) \DOCMODE2%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Some drivers, in particular \Textures, require the \PS\ dictionary to be included with every page shipped out. We do this by providing a routine which rebinds the |\shipout| primitive to a macro |\xyPSshipout@| which prepends the \XY-ps \PS\ dictionary to the box being shipped-out. This routine |\@PSshipout| is called, if necessary, when the driver has been specified. \DOCMODE( \xydef@\xyPSshipout@{\setbox9=\copy\voidb@x \afterassignment\xyPSshipout@i\setbox9=} \xydef@\xyPSshipout@i{\ifvoid9 \expandafter\aftergroup\fi\xyPSshipout@ii} \xydef@\xyPSshipout@ii{\TeX@shipout\vbox{\XYdict@\box9}} \xywarnifdefined\TeX@shipout \xydef@\@PSshipout{% \global\let\TeX@shipout=\shipout \global\let\shipout=\xyPSshipout@ } \DOCMODE) The box register |\box9| is assumed to by a scratch register, used globally according to \TeX\ conventions. \DOCMODE2%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \paragraph*{\PS\ {\tt\string\special} commands} The \PS\ |\special|s which are used by \XY-ps fall into four broad classes: \begin{itemize} \item[] execute a piece of code, e.g. to draw some graphic object; \item[] add a new \PS\ definition to the existing dictionary of commands; \item[] change the value of some parameters, storing them for later use; \item[] read \PS\ commands from a pre-existing file. \end{itemize} Since different drivers may provide different syntax for these classes of command, \XY-ps has different macros to optimize to interface to the different drivers. Initially these control-sequence names are bound to macros that do nothing. Upon specifying a driver, they will be bound to a macro appropriate for that driver. \DOCMODE( \xydef@\PSmacro@#1{\relax} \xydef@\PSdict@#1{\relax} \xydef@\PSspecial@#1{\relax} \xydef@\PSread@#1{\relax} \xydef@\PSinclude@#1{\relax} \DOCMODE) Here we distinguish between two distinct types of file-reading capability, depending on when the file is intended to be read. The |\PSread@| command is for immediate reading of the external file, placing its contents directly into the |.dvi| file via an appropriate |\special|. On the other hand the |\PSinclude@| processes only the name of the file; the driver must be able to find the file later for inclusion in the \PS\ file that it creates for the print-job. There is yet another type of file-reading command which most DVI-drivers support. This is for reading complete graphics files for placing a picture into a \TeX-document; e.g. Encapsulated \PS\ files, also known as |.eps| files, or $EPSF$-files or $EPSI$-files. These operate at a higher level in the \PS\ page-description; \XY-ps does NOT deal with such files. \DOCMODE3%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \subsection{\PS\ escape} ??=[postscript escape] An extra modifier key allows arbitrary \PS\ code to be applied to the current .\par \begin{defs} |[!||]| & for special effects\cr |[psxy]| & stores current location.\cr \end{defs} \DOCMODE( \xydefcsname@{*shapechar@!@}#1{\ifxyPSshapes@\DN@{\xyPSshapechar@{#1}@@}% \else \DN@{\xyPScharwarning@@}\fi \next@ } \xydefcsname@{*shape@psxy@}{\ifxyPSshapes@\DN@{\xyPSpsxy@}% \else \DN@{\xyPScharwarning@@}\fi \next@ } \DOCMODE) \noindent Normally the will be a simple command to alter the \PS\ graphics state: e.g. |[!1 0 0 setrgbcolor]| changes the colour used to render parts of the . Any number of such modifiers is allowable, however it is more efficient to combine them into a single modifier, whenever possible. It is very important that braces |{| and |}| do not appear explicitly in any , as this may upset the \XY-pic parsing. However it is acceptable to have a control sequence name here, expanding into more intricate \PS\ code. This will not be expanded until a later (safe) time. \DOCMODE3%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Due to differences within the DVI-drivers, such simple \PS\ commands need not affect every part of an . In particular the lines, curves and arrowheads generated by \XY-pic use a different mechanism, which should give the same result with all drivers. This involves redefining some \PS\ procedures which are always read prior to rendering one of these objects. One simple way to specify a red line is as follows; the |xycolor| extension provides more sophisticated support for colour. The modifiers described in the previous section also use this mechanism, so should work correctly with all drivers. \begin{code} \def\colorxy(#1){% /xycolor{#1 setrgbcolor}def} \connect[!\colorxy(1 0 0)]\dir{-} \end{code} \displaycode \noindent Note how the braces are inserted within the expansion of the control sequence |\colorxy|, which happens after parsing of the . The following table shows which graphics parameters are treated in this way, their default settings, and the type of \PS\ code needed to change them. \begin{defs} colour & |/xycolor{0 setgray}def| \cr line width & |/xywidth{.4 setlinewidth}def| \cr dashing & |/xydash{[] 0 setdash}def| \cr line-cap & |/xycap{1 setlinecap}def| \cr line-join & |/xyjoin{1 setlinejoin}def| \cr \end{defs} \noindent This feature is meant primarily for modifying the rendering of objects specified in \TeX\ and \XY-pic, not for drawing new objects within \PS. No guarantee can be given of the current location, or scale, which may be different with different drivers. However a good \PS\ programmer will be able to overcome such difficulties and do much more. To aid in this the special modifier |[psxy]| is provided to record the location where the reference point of the current will be placed. Its coordinates are stored with keys |xyXpos| and |xyYpos|. \DOCMODE2%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% When the |\special| is placed the following registers contain important values: |\Lp| = horizontal displacement of \XY-pic reference point from the \TeX\ reference point (i.e. left-hand end of the box) of the initial object; |\Dp| = vertical displacement of \XY-pic reference point from the \TeX\ reference point (i.e. the baseline) of the initial object; |\Rp| = horizontal offset, resulting from modifiers; |\Up| = vertical offset, initially |-\Dp| but alterable by modifiers. \DOCMODE( \xydef@\xyPSpsxy@{% \setboxz@h{\dimen@=\Lp \advance\dimen@-\Rp \dimen@ii=-\Up \raise\dimen@ii\hbox to\z@{% \kern\dimen@\xyPScurrpt@\kern-\dimen@}\boxz@}}% \xydef@\xyPScurrpt@{\ifxyPSshapes@\expandafter\xyPScurrpt@@\fi} \DOCMODE) Some drivers define this differently... \DOCMODE( \xydef@\xyPScurrpt@@{\PSspecial@{userdict begin 0 0 transform grestore gsave itransform /xyYpos exch def /xyXpos exch def end}} \DOCMODE) \DOCMODE2%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \subsubsection{Technical Note}: The scoping is achieved by using two |\specials| so that the resulting \PS\ file should ultimately look like: \begin{defs1} |... {| special code before|}| |{|special code after|} ...| \end{defs1} The ``code after'' is to cancel the effect, returning the graphics state to what it was prior to the ``code before''. Not all DVI-drivers can achieve this sequencing. In particular \OzTeX\ collects all |\specials| in the DVI-file and places their contents at the beginning of the \PS\ file: any effect would be cancelled immediately after it has been established. The user can add code to both parts by expressing the modifier as follows: \begin{defs1} ??c![*]\dots|!||<>||]|\dots\ .\cr \end{defs1} \DOCMODE2%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \subsubsection{Further Technical Note}: The ``code before'' does two things in addition to that code given explicitly by the user. Firstly it issues a |gsave| then it opens a new dictionary on the dictionary stack. The ``code after'' contains the matching |grestore| after closing the new dictionary. Since objects can be built as |\composite|s and diagrams can be nested, there is the possibility of generating long chains of nested \PS\ dictionaries. For this reason the dictionary is kept small, allowing only 8 key-value pairs to be |def|ined within it. If more are required, the user should define a private dictionary to hold the extra key-value pairs, making sure that it is open when its entries need to be accessed. \DOCMODE2%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \DOCMODE( \xywarnifdefined\xyPSshapechar@ \xywarnifdefined\xyPSsplitshape@ {\xyuncatcodes \catcode`@=11 \gdef\xyPSshapechar@#1@@{\xyPSsplitshape@#1<><>@@}% \gdef\xyPSsplitshape@#1<>#2<>#3@@{\xyPSsplitPS@{#1}{#2}}} \xydef@\xyPSsplitPS@#1#2{\def\xyPSpre@{#1}\def\xyPSpost@{#2}\modPSboxz@ } \xydef@\xyPSrawA@#1{\xyPSraw@{gsave mark{xypush #1}xy}}% \xydef@\xyPSrawZ@#1{% \xyPSraw@{currentfont mark{#1 xypop}xy grestore setfont}}% \xydef@\modPSboxz@{% \setboxz@h{\xyPSrawA@\xyPSpre@\boxz@\xyPSrawZ@\xyPSpost@}}% \xydef@\modPSdrop@{% \expandafter\DNii@\expandafter{% \expandafter\xyPSrawA@\expandafter{\xyPSpre@}}% \DN@##1{\expandafter\def\expandafter\tmp@\expandafter{\nextii@ ##1}}% \expandafter\next@\expandafter{\Drop@@}% \expandafter\DNii@\expandafter{% \expandafter\xyPSrawZ@\expandafter{\xyPSpost@}}% \DN@##1{\expandafter\def\expandafter\Drop@@\expandafter{\tmp@ ##1}}% \expandafter\next@\expandafter{\nextii@}}% \xydef@\modPSconnect@{% \expandafter\DNii@\expandafter{% \expandafter\xyPSrawA@\expandafter{\xyPSpre@}}% \DN@##1{\expandafter\def\expandafter\tmp@\expandafter{\nextii@ ##1}}% \expandafter\next@\expandafter{\Connect@@}% \expandafter\DNii@\expandafter{% \expandafter\xyPSrawZ@\expandafter{\xyPSpost@}}% \DN@##1{\expandafter\def\expandafter\Connect@@\expandafter{\tmp@ ##1}}% \expandafter\next@\expandafter{\nextii@}}% \xydef@\xyPSpre@{} \xydef@\xyPSpost@{} \DOCMODE) \DOCMODE2%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \subsection{Hooking into \XY-pic} ??=[hooks] \DOCMODE( \message{hooks,} \DOCMODE) Some utility macros for controlling writing to the log-file. \DOCMODE( \xydef@\PSmessage@#1{\W@{postscript: #1, direction=\the\Direction}} \xydef@\PSignore@#1{}% \xydef@\showPSmessages{\let\PSmessage=\PSmessage@} \xydef@\hidePSmessages{\let\PSmessage=\PSignore@} \xylet@\PStracing=\showPSmessages \hidePSmessages \DOCMODE) \DOCMODE2%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% This next macro streamlines the rebinding process. \DOCMODE( \gdef\xyPSalternative@#1#2{% \expandafter\global\expandafter\let\csname origxy#2@\endcsname=#1% \xdef#1{\noexpand\ifPSspecials@ \noexpand\expandafter\expandafter\noexpand\csname xyPS#2@\endcsname \noexpand\else \noexpand\expandafter\expandafter\noexpand\csname origxy#2@\endcsname \noexpand\fi}}% \DOCMODE) The commands |\setupxyPSlevelA@|, |\setupxyPSlevelB@|, |\setupxyPSlevelC@| and |\setupxyPSlevelD@| actually perform the rebindings. Each may be called precisely once, and each requires all lower levels are also set. \DOCMODE( \xydef@\setupxyPSlevelA@{% \xyPSalternative@{\tip@@}{tip}% \xyPSalternative@{\atip@@}{atip}% \xyPSalternative@{\btip@@}{btip}% \xyPSalternative@{\Tip@@}{Tip}% \xyPSalternative@{\Ttip@@}{Ttip}% \xyPSalternative@{\hook@@}{hook}% \xyPSalternative@{\ahook@@}{ahook}% \xyPSalternative@{\bhook@@}{bhook}% \xyPSalternative@{\aturn@@}{aturn}% \xyPSalternative@{\bturn@@}{bturn}% \xyPSalternative@{\squiggle@@}{squiggle}% \xyPSalternative@{\stopper@@}{stopper}% \xyPSalternative@{\line@@}{dash}% \xyPSalternative@{\circhar@@}{circhar@}% \xywithoption{cmtip}{\xyPScmtips@}% \gdef\setupxyPSlevelA@{\PSincrease@{1}}% \PSspecials@true} \xydef@\setupxyPSlevelB@{% \let\xyPSfont@=\empty \let\xyPSsemifont@=\empty \xyPSalternative@{\cirrestrict@@}{cirrest}% \gdef\setupxyPSlevelB@{\PSincrease@{2}}% \setupxyPSlevelA@ } \xydef@\setupxyPSlevelC@{% \xyPSalternative@{\cirbuild@}{cirbuild}% \xyPSalternative@{\CIRfull@}{CIRfull}% \xyPSalternative@{\solid@}{solid}% \xyPSalternative@{\point@}{point}% \xywithoption{curve}{% \xyPSalternative@{\splinesolid@}{splinesolid}}% \gdef\setupxyPSlevelC@{\PSincrease@{3}}% \setupxyPSlevelB@ }% \xydef@\setupxyPSlevelD@{% \xyPSalternative@{\dash@}{dashed}% % \xyPSalternative@{\squiggle@}{squiggled}% \xywithoption{curve}{% \xyPSalternative@{\splinedashed@}{splinedashed}% \xyPSalternative@{\splinedotted@}{splinedotted}}% \gdef\setupxyPSlevelD@{\PSincrease@{4}}% \setupxyPSlevelC@ } \DOCMODE) The bindings are not performed until |\setupxyPS@| is called. \DOCMODE2%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \subsection{Kernel improvements} ??=[kernel] \subsubsection*{Directionals:} These macros standardise the way a character is described in \PS. First give the |\Direction| code then the operator name, which is just a simple character string. The modifiers |\xyPSfont@| and |\xyPSsemifont@| are empty in all but the most primitive level of \PS\ usage. When non-empty they restrict to using only angles corresponding to actual font characters. \DOCMODE( \xydef@\xyPSchar@#1{% \PSmessage{\the\Direction\space #1}% \PSmacro@{\the\Direction\space \xyPSfont@ #1}} \xydef@\xyPSsemichar@#1{% \PSmessage{\the\Direction\space\xyPSsemifont@ #1}% \PSmacro@{\the\Direction\space \xyPSsemifont@ #1}} \DOCMODE) These macros provide \PS\ code to round a |\Direction| code to that corresponding to the nearest font character code, for Directional and Semi-Directional fonts respectively. \DOCMODE( \xydef@\xyPSfont@{xyfont } \xydef@\xyPSsemifont@{xysdfont } \DOCMODE) \DOCMODE2%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Before any binding we save the original expansions of control-sequences whose names will be subject to rebinding. We give these first for each font. \paragraph*{tips} Arrow heads in |\xyatipfont| and |\xybtipfont| The tips are all set as zero-sized characters\dots \DOCMODE( \xydef@\xyPStip@{\xyPSchar@{tip}}% \xydef@\xyPSatip@{\xyPSchar@{atip}}% \xydef@\xyPSbtip@{\xyPSchar@{btip}}% \xydef@\xyPSTip@{\xyPSchar@{Tip}}% \xydef@\xyPSTtip@{\xyPSchar@{Ttip}} \DOCMODE) The mechanism to handle Computer Modern tips is a little different. Here we must rebind |\xycm@| to avoid any calls to font names. When |\PSspecialstrue| then we expand a macro which will look at the following token to decide which type of tip is required after |\tip@x|. \DOCMODE( \xydef@\xyPScmtips@{\xyPSalternative@{\xycm@}{cm}}% \xydef@\xyPScm@\tip@x{\xyFN@\xyPScm@@}% \xydef@\xyPScm@@{% \ifx\next\tip@@ \DN@\tip@@{\tip@x\xyPScmtip@}% \else\ifx\next\atip@@ \DN@\atip@@{\tip@x\xyPScmatip@}% \else\ifx\next\btip@@ \DN@\btip@@{\tip@x\xyPScmbtip@}% \else\DN@{}% \fi\fi\fi \next@}% \xydef@\xyPScmtip@{\xyPSchar@{cmtip}}% \xydef@\xyPScmatip@{\xyPSchar@{cmatip}}% \xydef@\xyPScmbtip@{\xyPSchar@{cmbtip}}% \DOCMODE) \paragraph*{hooks, turns and squiggles:} squiggles from: |\xybsqlfont| The hooks are zero-sized characters\dots \DOCMODE( \xydef@\xyPShook@{\xyPSchar@{hook}} \xydef@\xyPSahook@{\xyPSchar@{ahook}} \xydef@\xyPSbhook@{\xyPSchar@{bhook}} \DOCMODE) \dots so are the turns\dots \DOCMODE( \xydef@\xyPSaturn@{\xyPSchar@{aturn}} \xydef@\xyPSbturn@{\xyPSchar@{bturn}} \DOCMODE) This handles squiggles as individual characters. Squiggled connections should be handled separately, e.g. by having |\xyPSsquiggle@| set the connection by something like |\edef\Connect@@{\noexpand\xyPSsquiggled@ {\the\Direction}}|. \DOCMODE( \xydef@\xyPSsquiggle@{\xyPSchar@{squigl}} \DOCMODE) \TODO: define composite |\xyPSsquiggled@| \TODO: define composite |\xyPSdashsquiggled@| \paragraph*{dashes and stoppers:} using characters from: |xydashfont| A stopper contributes zero size. However a dash gets its size from the italic correction in the |xydashfont|, accessed here using |\origxyline@@|. \DOCMODE( \xydef@\xyPSstopper@{\xyPSchar@{stopper}} \xydef@\xyPSfliptrue@{\DN@{\xyPSsemichar@{true dash}}} \xydef@\xyPSdash@{% \DN@{\xyPSsemichar@{false dash}}% \ifnum\SemiDirectionChar=31 \ifdim\dY<\z@ \ifdim\dX<\z@ \ifx\xyPSsemifont@\empty\xyPSfliptrue@\fi\fi \else \ifdim\z@>\dX \ifx\xyPSsemifont@\empty\else\xyPSfliptrue@\fi \else\xyPSfliptrue@\fi \fi\fi \next@ \setboxz@h{\origxydash@}\kern\wdz@ \setbox\z@=\box\voidb@x } \DOCMODE) \subsubsection*{Circles} full circles and circle segments: |\xycircfont| This handles the cases where a font character is called using |\circhar#1|. \DOCMODE( \xydef@\xyPScirchar@#1{\count@=#1\edef\tmp@{\the\count@}% \ifcase#1% \xyPScirchar@@@{-180}{-135}{\tmp@}\dimen@=.2929\R@ \or\xyPScirchar@@@{-135}{-90}{\tmp@}\dimen@=.7071\R@ \or\xyPScirchar@@@{-90}{-45}{\tmp@}\dimen@=.7071\R@ \or\xyPScirchar@@@{-45}0{\tmp@}\dimen@=.2929\R@ \or\xyPScirchar@@@0{45}{\tmp@}\dimen@=.2929\R@ \or\xyPScirchar@@@{45}{90}{\tmp@}\dimen@=.7071\R@ \or\xyPScirchar@@@{90}{135}{\tmp@}\dimen@=.7071\R@ \or\xyPScirchar@@@{135}{180}{\tmp@}\dimen@=.2929\R@ \fi} \xydef@\xyPScirrest@{\relax}% \DOCMODE) This replaces just the font character, called using |\circhar@@#1|. \DOCMODE( \xydef@\xyPScirchar@@#1{\relax\count@=#1\edef\tmp@{\the\count@}% \expandafter\xyPScirchar@@@\ifcase#1% {-180}{-135}{\tmp@}\kern.2929\R@\or{-135}{-90}{\tmp@}\kern.7071\R@% \or{-90}{-45}{\tmp@}\kern.7071\R@ \or{-45}0{\tmp@}\kern.2929\R@% \or 0{45}{\tmp@}\kern.2929\R@ \or{45}{90}{\tmp@}\kern.7071\R@% \or{90}{135}{\tmp@}\kern.7071\R@\or{135}{180}{\tmp@}\kern.2929\R@% \fi}%} \xydef@\xyPScirchar@@@#1#2#3{\edef\tmp@{#1\space#2\space \expandafter\removePT@\the\R@\space #3\space circhar}% \PSmessage{\tmp@}\PSmacro@{\tmp@}} \DOCMODE) This next macro will allow for more general circle segments to be done in \PS. The two parameters are the starting angle and finishing angle respectively, measured anti-clockwise. \DOCMODE( \xydef@\xyPScirc@#1#2{\edef\tmp@{\expandafter\removePT@\the\R@}% \PSmessage{\tmp@\space #1 #2 circ}\PSmacro@{\tmp@\space #1 #2 circ}} \DOCMODE) These gives full circles and circle segments built from quarter turns. \DOCMODE( \xydef@\xyPSCIRfull@{\setboxz@h{\kern\R@\xyPScirc@0{360}\kern\R@}% \wd\z@=\z@ \ht\z@=\R@ \dp\z@=\R@ \boxz@}% \xydef@\xyPScirbuild@{{% \count@=\CIRlo@@ \count@@=\CIRhi@@ \multiply\count@ by45 \advance\count@-180 \relax \multiply\count@@ by45 \advance\count@@-180 \relax \def\tmp@{}% \ifx\CIRtest@@\CIRtest@inside \ifnum\count@@>\count@ \edef\tmp@{\noexpand\xyPScirc@{\the\count@}{\the\count@@}}\fi \else\ifx\CIRtest@@\CIRtest@outside \ifnum\count@>-180 \advance\count@ by360 \relax \edef\tmp@{\noexpand\xyPScirc@{\the\count@@}{\the\count@}}% \else \ifnum\count@@<180 \relax \edef\tmp@{\noexpand\xyPScirc@{\the\count@@}{180}}% \fi\fi \fi\fi \kern\R@\tmp@\kern\R@}} \DOCMODE) \subsubsection*{Lines} solid, dashed and dotted; without using segments. This is based on |\straight@|. It is used by all three types of line, taking an appropriate macro as the parameter |#1|. \DOCMODE( \xydef@\xyPSstraight@#1{\setupDirection@ \edef\Creset@@{\cfromthec@ \pfromthep@ \DirectionfromtheDirection@}% \DN@##1##2{\def\checkoverlap@@{% \ifdim##1\Xp>##1\Xc \let\next@=\relax \fi \ifdim##2\Yp>##2\Yc \let\next@=\relax \fi}}% \edef\nextii@{{\sdX}{\sdY}}\expandafter\next@\nextii@ \noCshavep@@ \edef\Cshavep@@{\pfromthep@ \noexpand\resetDirection@}% \noCshavec@@ \edef\Cshavec@@{\cfromthec@ \noexpand\resetDirection@}% \ifHidden@\else \ifdim\Yc>\Ymax \Ymax=\Yc \fi \ifdim\Yp>\Ymax \Ymax=\Yp \fi \ifdim\Yc<\Ymin \Ymin=\Yc \fi \ifdim\Yp<\Ymin \Ymin=\Yp \fi \ifdim\Xc>\Xmax \Xmax=\Xc \fi \ifdim\Xp>\Xmax \Xmax=\Xp \fi \ifdim\Xc<\Xmin \Xmin=\Xc \fi \ifdim\Xp<\Xmin \Xmin=\Xp \fi \fi \ifInvisible@\let\next@=\relax \else \DN@{\setboxz@h{\kern\Xc \raise\Yc\hbox{#1}}% \ht\z@=\z@ \wd\z@=\z@ \dp\z@=\z@ {\Drop@@}}% \fi \checkoverlap@@ \ifdim\dX=\z@ \ifdim\dY=\z@ \DN@{\relax}\fi\fi \next@ \def\Cslidep@@{\noCslidep@@}\def\Cslidec@@{\noCslidec@@}% \def\Calong@@{\noCalong@@}\Creset@@ } \DOCMODE) Here is how solid lines are done. \DOCMODE( \xydef@\xyPSsolid@{%\ifx\unknown\xycolourboxz@ \ifInvisible@ \let\next@=\no@@ \else \DN@{\xyPSstraight@\xyPSsolid@@@}\fi % \else \DN@{{\Drop@@}}\fi \next@ } \xydef@\xyPSsolid@@@{\edef\tmp@{% \expandafter\removePT@\the\dX\space\expandafter\removePT@\the\dY}% \PSmessage{solid line: \tmp@}\PSmacro@{\tmp@\space solid}} \DOCMODE) These should be redundant; they will be removed in future versions. \DOCMODE( \xydef@\xyPSsolid@@{\ifdim\dX=\z@ \DN@{\xyPSvert@}% \else\ifdim\dY=\z@ \DN@{\xyPShoriz@}\else \DN@{\xyPSsolid@@@}\fi\fi \next@}% \xydef@\xyPSvert@{% \B@=\dp\lastobjectbox@ \advance\B@\ht\lastobjectbox@ \ifdim \B@=\z@ \count@@=\m@ne \else \dimen@=\sdY\dY \divide\dimen@\B@ \count@@=\dimen@ \fi \ifnum\count@@=\z@ \DN@{}\else \DN@{\xyPSsolid@@@}\fi \next@ } \xydef@\xyPShoriz@{% \A@=\wd\lastobjectbox@ \ifdim \A@=\z@ \count@@=\m@ne \else \dimen@=\sdX\dX \divide\dimen@\A@ \count@@=\dimen@ \fi \ifnum\count@@=\z@ \DN@{}% \else \DN@{\xyPSsolid@@@}\fi \next@ } \DOCMODE) This replaces the \XY-pic |\dash@| to give dashed lines: \DOCMODE( \xydef@\xyPSdashed@{\line@ \def\Connect@@{\xyPSstraight@\xyPSdashed@@}} \xydef@\xyPSdashed@@{\edef\tmp@{% \expandafter\removePT@\the\dX\space\expandafter\removePT@\the\dY }% \PSmessage{dashed line: \tmp@}\PSmacro@{\tmp@\space dashed}} \DOCMODE) This replaces the \XY-pic |\point@| to give dotted lines. \XY-pic defines |\zerodot| to be a small centred square with side length |\xydashw@|. The \PS\ substitute is a round dot of this radius. \DOCMODE( \xydef@\xyPSpoint@{\xyPSzerodot@\egroup \Invisible@false \Hidden@false \def\Leftness@{.5}\def\Upness@{.5}\ctipEdge@ \def\Drop@@{\boxz@}\def\Connect@@{\xyPSstraight@\xyPSdotted@}} \xydef@\xyPSdotted@{\edef\tmp@{% \expandafter\removePT@\the\dX\space\expandafter\removePT@\the\dY }% \PSmessage{dotted line: \tmp@}\PSmacro@{\tmp@\space dotted}} \xydef@\xyPSzerodot@{\PSmessage{dot}\PSmacro@{dot}} \DOCMODE) \DOCMODE3%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \subsection{Extensions} Several included file handle standard extensions. \DOCMODE2%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% A conditional |ifxyPSshapes@| is used to indicate whether the special shape effects implemented in \eg. |xyps-r.tex| and |xyps-l.tex| can actually be supported by the current driver. \DOCMODE( \xynew@{if}\ifxyPSshapes@ \xyPSshapes@false \DOCMODE) When not available, then an attempt to use these effects simply results in a warning message. After two attempts the warning message ``turns itself off''; subsequent attempts are simply ignored cleanly. \DOCMODE( \xydef@\xyPScharwarning@@{\xyPScharmessage@ \gdef\xyPScharwarning@@{\xyPScharmessage@ \xywarning@{...no further PostScript warnings will be given.}% \global\let\xyPScharwarning@@=\relax }} \xydef@\xyPScharmessage@{% \xywarning@{Current driver does not support PostScript effects.}}% \DOCMODE) \paragraph*{Allow new \PS\ effects to be defined.} This section describes how |\newxyPSshape| is used to define a new effect which is available only in \PS; \ie\ having no analogue elsewhere within \XY-pic. The new effect will be called via |[||]|, which gets interpreted as referring to |\csname xyshape@||@\endcsname|. Hence a control sequence of this form must first be created, if it does not already exist. Its initial expansion is simply |\xyundefinedEffect@{||}{}@@| which produces a warning message. \DOCMODE( \xydef@\newxyshape#1#2#3{% \DN@{#3}\ifx\next@\empty \xydefcsname@{*shape@#1@}{\csname xyshape@#1@\endcsname}% \else \expandafter\def\csname*shape@#1@\endcsname{% \csname xyshape@#1@\endcsname}\fi \DN@{#2}\ifx\next@\empty \expandafter\def\csname xyshape@#1@\endcsname{% \xyundefinedEffect@{#1}{}@@}% \else \expandafter\def\csname xyshape@#1@\endcsname{#2}\fi } \xydef@\xyundefinedEffect@#1#2@@{% \xywarning@{The #1 #2 effect is not implemented with the current driver.}}% \DOCMODE) When an implementation of the effect is available then |\csname xyshape@||@\endcsname| is rebound to |\csname xyPSshape@||@\endcsname|, which expands to the contents of |#2| in |\newxyPSshape#1#2|. If |#2| is empty then the expansion is the |\xyPSnotimplemented@@`||'@@| warning message. \DOCMODE( \xydef@\newxyPSshape#1#2{% \expandafter\DN@\expandafter{\csname *shape@#1@\endcsname}% \DNii@{\relax}\ifx\next@\nextii@ \newxyshape{#1}{}\relax\fi \expandafter\DNii@\expandafter{\csname xyPSshape@#1@\endcsname}% \expandafter\def\nextii@{#2}% \ifx\nextii@\empty\expandafter\def\next@{\xyPSnotimplemented@@`#1'@@}% \else \edef\tmp@{\noexpand\let\expandafter\noexpand\next@ \expandafter\noexpand\nextii@}\expandafter\tmp@\fi } \xydef@\xyPSnotimplemented@@#1@@{% \xywarning@{This PostScript effect is not implemented yet.}}% \xydef@\xyPSnotfinished@@{% \xywarning@{This effect is not reliable yet; box sizes may be wrong.}}% \DOCMODE) \DOCMODE2%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \paragraph*{Frames}\leavevmode These are used for dashed frames. \DOCMODE( \xydef@\xyPSdashhfill@{{\SemiDirectionChar=95 \Direction=3072 \xyPSdash@}} \xydef@\xyPSdashvfill@{{\SemiDirection=31 \Direction=1023 \xyPSdash@}} \DOCMODE) This may do circular frames. \DOCMODE( \xydef@\xyPScircled@#1{{\R@=#1\relax \setboxz@h{\dimen@=\Xc\advance\dimen@-\Rc\kern\dimen@ \raise\Yc\hbox{\xyPSCIRfull@}}% \ht\z@=\z@ \dp\z@=\z@ \wd\z@=\z@ \boxz@}} \DOCMODE) \paragraph*{Curves}\leavevmode \DOCMODE( \xydef@\xyPScubic@#1{\readsplineparams@ \PSmacro@{mark \cubicinfo@\space #1cubic}% \PSmessage{\cubicinfo@\space #1cubic}% \xydef@\xyPSsquine@#1{\readsplineparams@ \PSmacro@{mark \squineinfo@\space #1squine}% \PSmessage{\squineinfo@\space squine}% \DOCMODE) \DOCMODE( \xydef@\xyPSsplinesolid@{\ifx\splineinfo@\squineinfo@ \expandafter\xyPSsquine@\else\expandafter\xyPScubic@\fi{}} \xydef@\xyPSsplinedashed@{\ifx\splineinfo@\squineinfo@ \expandafter\xyPSsquine@\else\expandafter\xyPScubic@\fi{dash}} \xydef@\xyPSsplinedotted@{\ifx\splineinfo@\squineinfo@ \expandafter\xyPSsquine@\else\expandafter\xyPScubic@\fi{dot}} \DOCMODE) \DOCMODE2%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \paragraph*{Line styles} Line styles are defined in the auxiliary ??c![xyps-l.doc] file: \DOCMODE( \xywithoption{line}{% \xyinputorelse@{xyps-l}{\xyerror@{Could not load xyps-l}{}}}% \xycatcodes \DOCMODE) \DOCMODE1%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{description} \item[|xyps-l.tex|:] \DOCMODE3%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \inputdoc!{xyps-l.doc} \DOCMODE2%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \paragraph*{Colo(u)r} The |color| extension is supported by the auxiliary ??c![xyps-c.doc] file: \DOCMODE( \xywithoption{color}{% \xyinputorelse@{xyps-c}{\xyerror@{Could not load xyps-c}{}}}% \xycatcodes \DOCMODE) \DOCMODE1%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \item[|xyps-c.tex|:] \DOCMODE3%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \inputdoc!{xyps-c.doc} \DOCMODE2%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \paragraph*{Rotation} Rotation is defined in the auxiliary ??c![xyps-r.doc] file: \DOCMODE( \xywithoption{rotate}{% \xyinputorelse@{xyps-r}{\xyerror@{Could not load xyps-r}{}}}% \xycatcodes \DOCMODE) \DOCMODE1%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \item[|xyps-r.tex|:] \DOCMODE3%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \inputdoc!{xyps-r.doc} \DOCMODE1%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \end{description} \DOCMODE2%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \subsection{\PS\ Dictionary} \DOCMODE( \message{dictionary,} \xywarnifdefined\xyPSobeylines@ \xywarnifdefined\xyPSendline@@ {\catcode`\^^M=\active \gdef\XYdict@{{\xyPSobeylines@% \count@=\xydashl@\relax% \count@@=\xydashw@\relax% \let\PSfirst@@=\relax% \PSspecial@{% /XYdict where not{200 dict /XYdict exch def /xy{XYdict begin countdictstack /xylevel exch def xyopen xycolor stopped xyclose cleartomark end}def /xyc{{xysetcol}xy}def /xycc{{xychgcol}xy}def XYdict}if begin /xyopen{currentdict /XYddict known{XYddict null eq{}% {XYddict begin xyopen}ifelse}if}def /xyclose{countdictstack -1 xylevel 1 add{pop end}for}def /xycolor{0 setgray}bind def \PSdict@{% /xyopen{currentdict /XYddict known{XYddict null eq{}% {XYddict begin xyopen}ifelse}if}def /xycolor{0 setgray}bind def \PSdict@{% /xyclose{countdictstack -1 xylevel 1 add{pop end}for}def /xypush{8 dict /XYddict exch def XYddict begin}def /undef where {pop /xypop{countdictstack xylevel eq{}{end}ifelse currentdict /XYddict undef}def}% {/xypop{countdictstack xylevel eq{}{end}ifelse /XYddict null def}def}ifelse \PSdict@{% /xychgcol{/xycolor exch def}def % /xychgcol{cvn dup where{pop cvx /xycolor exch def}% % {cvs = ( unknown)= flush}ifelse}def /xysetcol{xypush xychgcol}def \PSdict@{% /xysize 10 def /xypspt{72 72.27 div dup scale}bind def /dimendiv{65536 div}bind def /xysegl \number\count@\space dimendiv def /xyopp{1 -1 scale}bind def \PSdict@{% /pscorrect{.85 mul}bind def /xy{countdictstack /xylevel exch def xyopen xycolor stopped xyclose cleartomark}def /xywidth{\number\count@@\space dimendiv pscorrect setlinewidth}bind def /xydash{[] 0 setdash}bind def /xycap{1 setlinecap}bind def /xyjoin{1 setlinejoin}bind def /xycolor{0 setgray}bind def \PSdict@{% /xyfont{4096 add 64 div round 64 mul 4096 sub}def /xysdfont{4096 add 32 div round 32 mul 4096 sub}def /xydots{xywidth 1 setlinecap [0 2] 0 setdash}bind def \PSdict@{% /setupDirection{dup -2048 lt{3072 add neg 1024 exch} {dup 0 lt{1024 add neg -1024}{dup 2048 lt{1024 sub -1024 exch} {3072 sub 1024}ifelse}ifelse}ifelse atan dup 180 gt{360 sub}if dup /XYdirection exch def rotate}def \PSdict@{% /xyCheckDir{dup 8 div 3 mul 3 -1 roll sub neg exch div 360 mul dup dup XYdirection sub 180 div round 180 mul XYdirection add dup 3 -1 roll sub abs 10 gt not{exch}if pop}def \ifdim\xydashw@=0pt\xydashw@=.4pt\fi% \count@@=\xydashw@\relax% \PSdict@{% /xyrulth{\number\count@@\space dimendiv pscorrect setlinewidth 0 setlinecap}bind def \PSdict@{% /gsavexy{gsave xypspt XYdirection rotate xywidth newpath 0 0 moveto}def /gchksavexy{gsave xypspt setupDirection xywidth newpath 0 0 moveto}def \PSdict@{% /gstartxy{gsave xypspt xywidth xycap xyjoin newpath 0 0 moveto}def /grulexy{gsave xyrulth newpath 0 0 moveto}def /xystroke{stroke grestore}bind def \PSdict@{% /arc4pop{arcto 4{pop}repeat}bind def /xyswap{XYdirection 180 add /XYdirection exch def}def \PSdict@{% /xyline{gstartxy setupDirection rlineto xystroke}def /dash{exch gchksavexy xysegl XYdirection dup -90 lt{pop neg}{90 gt{neg}if}ifelse exch{neg}if 0 rlineto xystroke}def /stopper{gstartxy setupDirection 0 xysegl 2 div rmoveto 0 xysegl neg rlineto xystroke }def }% \PSdict@{% /solid{gstartxy xydash xycap neg exch neg exch rlineto xystroke}def /dashed{gstartxy 2 copy dup mul exch dup mul add sqrt dup xysegl add xysegl 2 mul div round 2 mul 1 sub div [ exch dup ] 0 setdash xycap neg exch neg exch rlineto xystroke}def \PSdict@{% /dot{gstartxy 2 setlinecap [0 2] 0 setdash 1 0 rlineto xystroke}def /dotted{gstartxy 2 copy dup mul exch dup mul add sqrt dup 2 div round 1 add div 2 setlinecap [0 3 -1 roll] 0 setdash neg exch neg exch rlineto 0 0 rlineto xystroke}def \PSdict@{% /cubic{gstartxy xycap docubic} def /docubic{chkvalid {chkcubedge 8 -2 roll moveto curveto xystroke pop} {cleartomark grestore}ifelse}def /chkcubedge{2 copy 1.0 eq{0.0 eq{pop pop}{cubicedge}ifelse} {pop cubicedge}ifelse}def \PSdict@{% /dotcubic{gstartxy 1 setlinecap [0 2] 0 setdash docubic}def /dashcubic{gstartxy xycap [5 5] 0 setdash docubic}def \PSdict@{% /squine{gstartxy xycap dosquine}def /dosquine{chkvalid {chksquedge 2 copy moveto xysq2cub curveto xystroke pop} {cleartomark grestore}ifelse}def \PSdict@{% /chkvalid{2 copy lt{dup 1 gt{false}{true}ifelse}{false}ifelse}def \PSdict@{% /chksquedge{2 copy 1.0 eq{0.0 eq{pop pop}{squineedge}ifelse} {pop squineedge}ifelse}def /xysq2cub{xysq2cubit 6 1 roll xysq2cubit 6 1 roll 3 index 3 index xysq2cubit 6 1 roll xysq2cubit 6 1 roll pop pop}def /xysq2cubit{2 index 2 mul add 3 div}def \PSdict@{% /dotsquine{gstartxy 1 setlinecap [0 2] 0 setdash dosquine}def /dashsquine{gstartxy xycap [5 5] 0 setdash dosquine}def \PSdict@{% /xy4mul{8 copy 5 -1 roll mul 5 1 roll 6 -1 roll mul 6 1 roll 3 -1 roll mul exch 4 -1 roll mul 3 1 roll add 3 1 roll add exch 10 2 roll 7 -1 roll mul 7 1 roll 4 -1 roll mul 5 1 roll 4 -1 roll mul 4 1 roll mul add 3 1 roll add exch 3 -1 roll }def }% \PSdict@{% /xy44mul{ 4 copy 16 4 roll exch 3 1 roll 4 copy 12 4 roll xy4mul 12 4 roll xy4mul 12 -4 roll 4 copy 16 4 roll 8 4 roll xy4mul 12 4 roll xy4mul}def \PSdict@{% /cubicedge{10 2 roll exch 8 1 roll 3 -1 roll dup dup 9 2 roll 5 -1 roll dup dup 9 1 roll 8 3 roll 4 1 roll dup dup 5 3 roll dup dup 5 1 roll 3 -1 roll 18 -2 roll 2 copy 1 sub neg 4 1 roll 1 sub neg exch 4 1 roll xy444mul pop pop pop 13 1 roll pop pop pop 9 1 roll 10 1 roll pop 8 1 roll 7 1 roll 8 1 roll pop 5 1 roll 3 1 roll }def \PSdict@{% /xy444mul{ 4 copy 24 4 roll 12 -4 roll 16 4 roll 4 copy 16 4 roll xy44mul 20 8 roll xy44mul 12 -4 roll 4 -1 roll 7 1 roll exch 4 1 roll exch 6 -1 roll exch 4 2 roll 16 8 roll 8 4 roll 4 -1 roll 7 1 roll exch 4 1 roll exch 6 -1 roll exch 4 2 roll 8 4 roll 16 4 roll 8 4 roll 20 -4 roll exch 3 1 roll 4 copy 20 4 roll 4 copy 16 4 roll 4 copy 12 4 roll xy4mul 28 4 roll xy4mul 20 4 roll xy4mul 12 4 roll xy4mul}def \PSdict@{% /squineedge{8 2 roll exch 5 1 roll 3 -1 roll dup 6 2 roll 1 index exch 10 -2 roll 2 copy 1 sub neg 4 1 roll 1 sub neg exch 4 1 roll xy44mul 4 1 roll pop 5 1 roll 6 1 roll 3 -1 roll pop}def \PSdict@{% /xyshort{2 copy abs exch abs add xysegl .5 mul lt {pop pop grestore}{rlineto xystroke}ifelse}def \PSdict@{% /tipwidth{xywidth xycap}def \PSdict@{% /halftip{tipwidth xysize 10 div 0 0 moveto -.25 0 3 -1 roll -2.5 mul 0 xysize 2 div neg dup .62 mul 2 div neg curveto}bind def \PSdict@{/atip{gchksavexy halftip xystroke}def}% \PSdict@{/btip{gchksavexy xyopp halftip xystroke}def}% \PSdict@{/tip{gchksavexy gsave halftip stroke grestore xyopp halftip xystroke}def}% \PSdict@{% /halfcmtip{tipwidth 0 0 moveto -.1333 xysize mul 0 .2 xysize mul neg dup .125 xysize mul 3 -1 roll .25 xysize mul curveto}bind def \PSdict@{/cmatip{gchksavexy halfcmtip xystroke}def}% \PSdict@{/cmbtip{gchksavexy xyopp halfcmtip xystroke}def}% \PSdict@{/cmtip{gchksavexy gsave halfcmtip stroke grestore xyopp halfcmtip xystroke}def}% \PSdict@{/halfTip{360 32 div neg rotate halftip}bind def}% \PSdict@{/halfTtip{.31 mul 1 atan rotate halftip}bind def}% \PSdict@{/aTip{gchksavexy halfTip xystroke}def}% \PSdict@{/bTip{gchksavexy xyopp halfTip xystroke}def}% \PSdict@{/Tip{gchksavexy gsave halfTip stroke grestore xyopp halfTip xystroke}def}% \PSdict@{/Ttip{gchksavexy xysegl neg 0 rlineto 0 0 moveto gsave -1 halfTtip stroke grestore xyopp -1 halfTtip xystroke}def}% \PSdict@{/halfturn{xysegl 2 div dup dup neg exch rmoveto 0 exch dup exch -180 -90 arc}bind def}% \PSdict@{/aturn{gchksavexy halfturn xystroke}def}% \PSdict@{/bturn{gchksavexy xyopp halfturn xystroke}def}% \dimen@=\xybsqll@\relax\count@=\dimen@% \PSdict@{% /xysqll \the\count@\space dimendiv def /squigl{gchksavexy xysqll dup neg 0 rmoveto 2 div dup dup neg dup 3 -1 roll 2 sqrt mul dup 5 1 roll 135 45 arcn dup 3 -1 roll -135 -45 arc xystroke}def \PSdict@{/fullhook{0 xysegl 2 div dup -90 90 arcn}bind def}% \PSdict@{/ahook{gchksavexy fullhook xystroke}def}% \PSdict@{/bhook{gchksavexy xyopp fullhook xystroke}def}% \PSdict@{/halfhook{xysegl 2 div dup 0 exch 180 90 arcn}bind def}% \PSdict@{/hook{gchksavexy gsave halfhook stroke grestore xyopp halfhook xystroke}def}% %\PSdict@{/halfstop{90 rotate xysegl 1.4 mul 0 rlineto}bind def} %\PSdict@{/astop{gsavexy halfstop xystroke}def} %\PSdict@{/bstop{gsavexy xyopp halfstop xystroke}def} %\PSdict@{/abstop{gsavexy 90 rotate xysegl 1.4 mul % dup 2 div 0 rmoveto neg 0 rlineto xystroke}def} \PSdict@{% /xyqcirc{dup dup neg exch translate newpath dup neg 0 exch moveto 0 0 3 -1 roll -90 0 arc}bind def \PSdict@{% /circ{gstartxy 3 copy pop 2 copy cos mul 3 1 roll sin mul rmoveto 0 0 5 2 roll arc xystroke}bind def \PSdict@{% /circhar{gsave dup 3 gt{7 sub neg}if dup 3 eq{pop dup 2 sqrt -2 div mul}{dup 1 eq{pop dup 2 sqrt 2 div mul} {0 eq{dup}{0}ifelse}ifelse}ifelse 0 translate 3 1 roll circ grestore}bind def \PSdict@{userdict begin /gray{setgray}bind def /gray@{setgray}bind def /rgb{setrgbcolor}bind def /rgb@{setrgbcolor}bind def /hsb{sethsbcolor}bind def /hsb@{sethsbcolor}bind def /setcmykcolor where{pop}{/setcmykcolor{dup 3 1 roll dup 5 1 roll exch sub 1 add 5 1 roll exch sub 1 add 4 1 roll exch sub 1 add 3 1 roll setrgbcolor}bind def}ifelse /cmyk{setcmykcolor}bind def /cmyk@{setcmykcolor}bind def /sethalftone where{/sethalftone load /tone exch def}if }\endXYdict@}% }% end of \obeylines \DOCMODE) \DOCMODE2%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \paragraph*{The end \& Log}\leavevmode \DOCMODE( \xyendinput % $Log: xyps.doc,v $ % Revision 2.12 1994/10/25 03:01:14 ross % Final 3beta release [bug fixes & AMS-LaTeX fitting]. % Revision 2.11 1994/07/05 06:34:32 ross % fixed bug with quadratic curves % fixed minor documentation bugs % Revision 2.10 1994/06/15 12:46:03 ross % Second release 3beta. % Colour and line style saving works; label colouring bug fixed. % Revision 2.9 1994/06/09 14:50:54 ross % Release 3beta. % Includes support for special effects: Rotations, Scaling, Line-width, Colour. % Back-ends are separated into separate files. % More back-ends are supported, experimentally --- needs testing. % Revision 2.8 1994/04/08 10:36:40 ross % Second 3alpha release. % Revision 2.7 1994/03/28 10:57:02 ross % First version. % Initial version by Ross Moore based on XYps 2.6. \DOCMODE) \DOCMODE3%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Tell Emacs that this is a LaTeX document and how it is formatted: % Local Variables: % mode:latex % fill-column:77 % fill-prefix:"" % End: